package Practice2;

public class ExceptionPractice3 {
    public static void main(String[] args) {
        //第一遍
        //TryCatchDemo
        System.out.println("程序开始了");
        try{
            String str1 = null;
            System.out.println(str1.length());
            String str2 = "";
            System.out.println(str2.charAt(0));
            String str3 = "我和你";
            Integer i = Integer.parseInt(str3);
        }catch(NullPointerException | StringIndexOutOfBoundsException | ClassCastException e){
            System.out.println("问题解决了");
        }catch(Exception e){
            System.out.println("问题真的解决了");
        }
        System.out.println("程序结束了");

        //FinallyDemo
        System.out.println("程序开始了");
        try{
            String str4 = null;
            System.out.println(str4.length());
            String str5 = "";
            System.out.println(str5.charAt(0));
            return;
        }catch(NullPointerException | StringIndexOutOfBoundsException e){

        }
    }
}
